/* 问题反馈store */
const useProblemStore = defineStore('problem', {
	state: () => ({
		purchase: {}, // 标准采购问题反馈
		style: {}, // 款式列表问题反馈
		bill: {}, // 对账问题反馈
		material: {}, // 物料接收问题反馈
		system: {} // 系统问题反馈
	}),

	actions: {
		setPersistStore(type, payload) {
			if (!type) return false
			switch (type) {
				case 'purchase':
					this.purchase = payload
					break
				case 'style':
					this.style = payload
					break
				case 'bill':
					this.bill = payload
					break
				case 'material':
					this.material = payload
					break
				default:
					break
			}
		}
	},

	// 持久化配置
	persist: {
		paths: null, // 持久化整个state
		// paths: ['purchase', 'style', 'bill', 'material', 'system'],
		storage: sessionStorage // 存储位置
	}
})

export default useProblemStore
